package com.lcm.jnode.model;

import java.util.List;

import com.jfinal.plugin.activerecord.Model;
import com.lcm.jnode.config.Constants;

/**
 * 博文标签表
 * @author L.cm
 * @date Jun 18, 2013 11:14:28 PM
 */
public class BlogTag extends Model<BlogTag> {

    private static final long serialVersionUID = -2208881735662609833L;
    public static final BlogTag dao = new BlogTag();
    
    public static final String ID = "id";					// id
	public static final String BLOG_ID = "blog_id";			// blog_id
	public static final String TAG_ID = "tag_id";			// tag_id
	public static final String DEL_STATUS = "del_status";	// 是否删除 默认：0  删除：1 
	public static final String CREATE_TIME = "create_time"; // 添加时间
	public static final String UPDATE_TIME = "update_time"; // 更新时间
	
	// 博文标签list
	public List<BlogTag> findBlogTagList(Integer id) {
		String sql = "SELECT t.tag_id, ts.tag_name FROM blog_tags t, l_tags ts WHERE t.tag_id = ts.id AND t.blog_id =? GROUP BY t.tag_id ORDER BY t.id DESC";
		return dao.findByCache(Constants.CACHE_TIME_MINI, sql, id);
	}
}
